// 二叉树的基本操作
package main

import (
    "learn/btree"
    "fmt"
)

func main() {
    root := btree.NewNode(nil, nil)
    root.SetData("root node")
    a := btree.NewNode(nil, nil)
    a.SetData("left node")
    al := btree.NewNode(nil, nil)
    al.SetData(100)
    ar := btree.NewNode(nil, nil)
    ar.SetData(3.14)
    a.Left = al
    a.Right = ar
    b := btree.NewNode(nil, nil)
    b.SetData("right node")
    root.Left = a
    root.Right = b
    // 使用Operater接口实现对二叉树的基本操作
    var it btree.Operater
    it = root
    it.PrintBT()
    fmt.Println()
    fmt.Println("The depths of Btree is:", it.Depth())
    fmt.Println("The leaf counts of the Btree is:", it.LeafCount())
}
